package xyz.o0o0o.demo.luajDemo;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.luaj.vm2.LoadState;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.jse.JsePlatform;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) throws FileNotFoundException, IOException {
		 LuaValue globals = JsePlatform.standardGlobals();
		 LuaValue chunk = LoadState.load( App.class.getResourceAsStream("/play.lua"), "play.lua", globals );
		 chunk.call();
		 LuaValue[] params = new LuaValue[3];
		 params[0] = LuaValue.valueOf("2");
		 params[1] = LuaValue.valueOf("1");
		 params[2] = LuaValue.valueOf("01020304050607#10");
		 
		 Varargs result = globals.get("play_check").invoke(params);
		 
		 System.out.println(result.arg1() +" : "+result.arg(2)+" : "+result.arg(3)+" : "+result.arg(4));
	}
}
